<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let obj = {a: 10, b: 20,c: 30}
    console.log(obj) // {a: 10, b: 20,c: 30}

    obj.a = 100
    console.log(obj) // {a: 100, b: 20,c: 30}


    console.log('---------------')
    let o = {name: 'zs', age: 18, sex: undefined, desc:{a: 100}, fn(){
      console.log('fn')
    }}

    // JSON.parse + JSON.stringify 配合实现深拷贝, 问题??但是如果出现值是undefined 或者函数 不会进行拷贝
    const o2 = JSON.parse(JSON.stringify(o))
    o2.desc.a = 999
    console.log(o);
    console.log(o2);

  </script>
</body>
</html>